package com.sixth.volunteerservicesystem.Controller.DonationController.frontDonation;

import com.sixth.volunteerservicesystem.Dao.DonationRepository;
import com.sixth.volunteerservicesystem.domain.DonationProjects;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * @author Steve Jobs
 * @create 2020-12-22 20:08
 */
@Controller
public class DonationDetail {

    @Autowired
    DonationRepository donationRepository;

    @RequestMapping("/donationDetail/{id}")
    public String donationDetail(@PathVariable("id") Integer id, Model model){
        DonationProjects donationProjects = donationRepository.findById(id).get();
        model.addAttribute("detail", donationProjects);
        return "/donation/donationDetail";
    }
}
